package cate.game.play.skill.active;

import cate.common.util.XT;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;
import cate.game.play.skill.effect.SkillEffect;

import java.util.List;

/**
 * 效果：对敌方全体造成40%伤害并从【锢疗】【致盲】【无力】【中毒】中随机附加两种负面状态，
 * 强化效果：伤害变成真实伤害
 */
public class 血气震荡AH extends ActiveHandler{

	private List<Integer> 负面buff;

	private int 数量;

	private Byte 技能性质;

	//负面buff=？？#？？&数量=2&技能性质=3
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		负面buff = args.getIntList("负面buff");
		数量 = args.getInt("数量", 0);
		技能性质 = args.getByte("技能性质", null);
	}

	@Override
	public void parseExt(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		数量 += args.getInt("数量", 0);
		技能性质 = args.getByte("技能性质", 技能性质);
	}

	@Override
	public void afterSelectTargets(SkillActionCtx action, SkillEffect effect) {
		if (技能性质 == null) {
			return;
		}
		effect.setNature(技能性质);
	}

	@Override
	public void afterSingleEffect(SkillActionCtx action, SkillEffect effect, Fighter target) {
		if(XT.isNotBlank(负面buff)){
			for (Integer buff : XT.randomPick(负面buff, 数量, true)) {
				target.buff.tryAddByTid(action, skill.owner, buff);
			}
		}
	}
}
